package com.childenglish.service;

import org.springframework.stereotype.Service;

import java.util.*;

@Service
public class LearningProgressService {

    /**
     * 记录学习进度
     */
    public void recordProgress(Long userId, String module, int progress, int score) {
        // 模拟记录学习进度到数据库
        System.out.printf("记录用户 %d 在模块 %s 的进度: %d%%, 得分: %d\n",
                userId, module, progress, score);
    }

    /**
     * 获取学习报告
     */
    public Map<String, Object> getLearningReport(Long userId) {
        Map<String, Object> report = new HashMap<>();

        // 模拟学习报告数据
        report.put("userId", userId);
        report.put("totalStudyTime", 120); // 分钟
        report.put("completedLessons", 15);
        report.put("averageScore", 85);
        report.put("progress", 60);
        report.put("strengths", Arrays.asList("听力", "词汇"));
        report.put("weaknesses", Arrays.asList("语法", "发音"));

        return report;
    }

    /**
     * 获取学习统计
     */
    public Map<String, Object> getLearningStatistics(Long userId) {
        Map<String, Object> stats = new HashMap<>();

        // 模拟学习统计数据
        stats.put("dailyStudyTime", 30);
        stats.put("weeklyStudyTime", 210);
        stats.put("monthlyStudyTime", 840);
        stats.put("totalWordsLearned", 150);
        stats.put("currentStreak", 7);

        return stats;
    }
}